home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / programming / other / tandem / teaching / 40.asm < prev    next >
Assembly Source File  |  1999-09-06  |  3KB  |  92 lines

  1. * 40.asm    more TLreqinfo          version 0.01    8.6.99
  2.  
  3.  
  4.  include 'Front.i'         ;*** change to 'Tandem.i' to step thru TL's ***
  5.  
  6.  
  7. ; This is like Teaching/39.asm, but it uses a set of custom buttons.
  8.  
  9. ; If \3=3, then \2 must be 2+. The last string is 1 or more strings for
  10. ; button contents, separated by \ characters.
  11.  
  12.  
  13. strings: dc.b 0
  14. st_1: dc.b 'Test Reqinfo',0 ;1
  15.  dc.b 'This is the first line of info,',0 ;2
  16.  dc.b 'whereas this is the second line.',0 ;3
  17.  dc.b '.... Finally, the *third* line!!',0 ;4
  18.  dc.b 'Press <Help> for even more info!',0 ;5
  19.  dc.b '1st\2nd\3rd',0 ;6
  20.  dc.b 'Error: The requester won''t fit!!',0 ;7
  21.  dc.b 'Error: Can''t open screen & window - out of chip memory',0 ;8
  22.  dc.b 'Error: Can''t open the ASL font requester',0 ;9
  23.  dc.b 'Error: Can''t load your selected font',0 ;10
  24.  dc.b 'You selected 1st',0 ;11
  25.  dc.b 'You selected 2nd',0 ;12
  26.  dc.b 'You selected 3rd',0 ;13
  27.  dc.b 'Here is some help!!',0 ;14
  28.  dc.b 'The 3 lines of info are presented for',0 ;15
  29.  dc.b 'your delectation. When you''ve done',0 ;16
  30.  dc.b 'enjoying it, click one of the buttons',0 ;17
  31.  dc.b 'at the bottom.',0 ;18
  32.  dc.b 'Eat healthy meals, avoid illegal drugs.',0 ;19
  33.  
  34.  ds.w 0
  35.  
  36.  
  37. * test Reqinfo
  38. Program:                                  ;Note carefully how this program
  39.  TLwindow #0,#0,#0,#200,#100,#640,#300,#0,#st_1 ;gives error reports.
  40.  bne.s Pr_open                            ;If something goes wrong in the
  41.  TLbad #8       ;quit if can't            ;warm-up. This is an important
  42.  rts                                      ;aspect of user friendliness. Also
  43. Pr_open:                                  ;Help is always available
  44.  TLaslfont #1   ;select font 1
  45.  bne.s Pr_ofont ;go if ok
  46.  tst.l xxp_errn(a4)
  47.  beq Pr_redi    ;if font selection cancelled, use default font
  48.  TLbad #9       ;if Asl font request failed, return bad
  49.  bra Pr_quit
  50.  
  51. Pr_ofont:
  52.  TLnewfont #1,#2,#1 ;put font 1 bold in req
  53.  TLnewfont #1,#0,#2 ;put font 1 plain in help
  54.  bne.s Pr_redi
  55.  TLbad #10      ;bad if can't
  56.  bra.s Pr_quit
  57.  
  58. Pr_redi:
  59.  bsr Test       ;Test TLReqinfo
  60.  
  61. Pr_quit:
  62.  rts
  63.  
  64.  
  65. * test TLReqinfo
  66. Test:
  67.  move.w #14,xxp_Help(a4)  ;help from line 14
  68.  move.w #5,xxp_Help+2(a4) ;5 lines thereof
  69.  clr.w xxp_ReqNull(a4)    ;first get requester dimensions
  70.  TLreqinfo #2,#4,#3
  71.  bne.s Te_ok
  72.  TLbad #7                 ;bad if requester won't fit
  73.  rts
  74.  
  75. Te_ok:
  76.  move.l xxp_AcWind(a4),a5 ;a5=WSuite of window
  77.  move.l xxp_Width(a4),d0  ;center the requester on screen
  78.  sub.l xxp_reqw(a4),d0
  79.  lsr.w #1,d0
  80.  move.w d0,xxp_ReqLeft(a5)
  81.  move.l xxp_Height(a4),d0
  82.  sub.l xxp_reqh(a4),d0
  83.  lsr.w #1,d0
  84.  move.w d0,xxp_ReqTop(a5)
  85.  TLreqinfo #2,#5,#3        ;now, put up requester for real
  86.  add.w #10,d0              ;choice becomes 11/12/13
  87.  move.w #19,xxp_Help(a4)   ;update help
  88.  move.w #1,xxp_Help+2(a4)
  89.  TLreqinfo d0              ;report choice (default /2,/3=#1,#1)
  90.  rts
  91.  
  92.